package com.example.PolimiAssistant.common;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextView;
import com.Wsdl2Code.WebServices.PolimiAssistant.UserCurrentSchedule;
import com.example.PolimiAssistant.R;
import com.example.PolimiAssistant.adapters.AcademicScheduleListAdapter;

import java.util.ArrayList;

/**
 * Created by alejo on 6/28/14.
 */
public class WeekDayFragment extends Fragment {

    /**
     * Identifier for this fragment
     */
    public static final String WEEK_DAY = "week_day";

    /**
     * List with the information of the day schedules
     */
    public ArrayList<UserCurrentSchedule> schedule;

    /**
     * List adapter for the schedule course list
     */
    AcademicScheduleListAdapter academicScheduleListAdapter;

    /**
     * Page context
     */
    public Context context;

    public WeekDayFragment(Context context, ArrayList<UserCurrentSchedule> schedule){
        this.schedule = schedule;
        this.context = context;
    }

    @Override
    public View onCreateView(LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {

        View fragmentView;
        fragmentView = inflater.inflate(R.layout.academic_schedule_weekday, container, false);

        ListView listView;
        listView = (ListView)fragmentView.findViewById(R.id.academic_schedule_list);

        if(schedule != null){

            academicScheduleListAdapter = new AcademicScheduleListAdapter(
                    context, schedule);
            academicScheduleListAdapter.setInflater(inflater);
            listView.setAdapter(academicScheduleListAdapter);
        }

        return fragmentView;
    }

}
